<template>
  <div>
    <el-container>
      <el-header>Header
        <div>
          <button @click="testVuex">点我试试{{this.$store.state.count}}</button>
        </div>
      </el-header>
      <el-main>Main</el-main>
      <el-footer>Footer</el-footer>
    </el-container>
  </div>
</template>

<script>
  // 1. 引入vuex组件
  import store from '../vuex/store.js';

  // 2. 注册组件
  export default {
    name: "Login",
    data() {
      return {
      };
    },
    store,  // 注册组件
    methods: {
      openDialog(event) {   //代开模态框
        // this.gridData[0].name = '张彭洋明';
        this.dialogFormVisible = true;
      },
      testVuex() {
        this.$store.commit("increment");  // 在js中可以和下面两行交换
        // store.commit("increment");
        console.log(store.state.count);
      }
    }
  }
</script>

<style scoped>

</style>
